from agent import agent_executor
from chain import planner
from graph import graph
# resp = agent_executor.invoke({"messages": [("user", "who is the winnner of the us open")]})


# resp = planner.invoke(
#     {
#         "messages": [
#             ("user", "what is the hometown of the current Australia open winner?")
#         ]
#     }
# )

# print(resp)


config = {"recursion_limit": 50}
inputs = {"input": "what is the hometown of the mens 2024 Australia open winner?"}

# async for event in graph.astream(inputs, config=config):
#     for k, v in event.items():
#         if k != "__end__":
#             print(v)

import asyncio

async def process_events(graph, inputs, config):
    async for event in graph.astream(inputs, config=config):
        for k, v in event.items():
            if k != "__end__":
                print(v)


asyncio.run(process_events(graph, inputs, config))